<?php


namespace app\api\controller;
use app\api\model\Lottery as LotteryModel;


class Lottery extends Controller
{   
    public function index(){
        $model = new LotteryModel;
        $lottery = $model->getLotteryInfo($this->getUser(false));
        if($lottery['status'] == 100){
            return $this->renderError($lottery['msg']);
        }else{
            $lotteryInfo = $lottery['lotteryInfo'];
            $jiangpin = $lottery['jiangpin'];
            return $this->renderSuccess(compact('lotteryInfo','jiangpin'));
        }
    }
    public function startUp(){
        $model = new LotteryModel;
        $lottery = $model->startUp($this->getUser(false));
        if($lottery['status'] == 100){
            return $this->renderError($lottery['msg']);
        }else{
            $zhongJiangIndex = $lottery['zhongJiangIndex'];
            $zjName = $lottery['zjName'];
            $jiang = $lottery['jiang'];
            return $this->renderSuccess(compact('zhongJiangIndex','zjName','jiang'));
        }
    }
}